//配置核心文件
import {createWebHashHistory,createRouter}from "vue-router"
import { MyRouterRecordRaw } from "../typing/router"

import Login from "../views/login/index.vue"
import Layout from "../views/layout/index.vue"
// 配置路由关系
let routes:Array<MyRouterRecordRaw>=[
    {
        path:"/",
        redirect:"/login"
    },
    {
        path:"/login",
        component: Login
    },
    // 后台首页--数据中心/首页
    {
        path:"/home",
        component: Layout,
        meta:{
            title:"数据中心"
        },
        redirect:"/home/index",
        children:[
            {
                path:"index",
                meta:{
                    title:"首页"
                },
                component:()=>import("../views/home/index.vue")
            }
        ]
    },
    // 客服中心
    {
        path:"/server",
        component: Layout,
        meta:{
            title:"客服中心"
        },
        redirect:"/server/order",
        children:[
            {//订单管理
                path:"order",
                meta:{
                    title:"订单管理"
                },
                component:()=>import("../views/server/order.vue")
            }
        ]
    },
    // 审核中心
    {
        path:"/examine",
        component: Layout,
        meta:{
            title:"审核中心"
        },
        redirect:"/examine/merchant",
        children:[
            {//商户审核
                path:"merchant",
                meta:{
                    title:"商户审核"
                },
                component:()=>import("../views/examine/merchant.vue")
            },
            {//师傅审核
                path:"master",
                meta:{
                    title:"师傅审核"
                },
                component:()=>import("../views/examine/master.vue")
            }
        ]
    },
    // 运营中心
    {
        path:"/operate",
        component: Layout,
        meta:{
            title:"运营中心"
        },
        redirect:"/operate/special",
        children:[
            {//专题管理
                path:"special",
                meta:{
                    title:"专题管理"
                },
                component:()=>import("../views/operate/special.vue")
            },
            {//项目管理
                path:"project",
                meta:{
                    title:"项目管理"
                },
                component:()=>import("../views/operate/project.vue")
            }
        ]
    },
    // 管理中心
    {
        path:"/manage",
        component: Layout,
        meta:{
            title:"管理中心"
        },
        redirect:"/manage/company",
        children:[
            {//公司管理
                path:"company",
                meta:{
                    title:"公司管理"
                },
                component:()=>import("../views/manage/company.vue")
            },
            {//部门管理
                path:"department",
                meta:{
                    title:"项目管理"
                },
                component:()=>import("../views/manage/department.vue")
            }
        ]
    },
    // 账号管理
    {
        path:"/acc",
        component: Layout,
        meta:{
            title:"账号管理"
        },
        redirect:"/acc/personel",
        children:[
            {
                path:"personel",
                meta:{
                    title:"个人中心"
                },
                component:()=>import("../views/acc/personel.vue")
            },
            {
                path:"anList",
                meta:{
                    title:"账号列表"
                },
                component:()=>import("../views/acc/anList.vue")
            },
            {
                path:"anAdd",
                meta:{
                    title:"账号添加"
                },
                component:()=>import("../views/acc/anAdd.vue")
            },
            {
                path:"modifyPw",
                meta:{
                    title:"修改密码"
                },
                component:()=>import("../views/acc/modifyPw.vue")
            },

        ]
    },


    // 容错页面
    {
        path:"/:pathMatch(.*)*",
        component: ()=>import("../views/err/index.vue")
    },
]

// 配置路由参数
let router = createRouter({
    routes,
    history: createWebHashHistory()
});


// 导出暴露路由
export default router



